//处理提交表单返回的数据
var successCallback = function (data) {
    var tip = '';
    tip = '更新成功,正在跳转...';
    tooltipWrong($('#requestSubmit'), tip, 3);
    switch (data.status) {
        case 200:
            window.location.reload();
            break;
    }
};


var errorCallback = function (data) {
    if (typeof (data.responseJSON) == "undefined") {
        tooltipWrong($('#requestSubmit'), '系统内部错误', 3);
    }
    tip = data.responseJSON.info;
    tooltipWrong($('#requestSubmit'), tip, 3);
}


$(function () {
    var mobileResult = false;
    $('#requestMobile').on('blur', function (e) {
        e.preventDefault();
        switch (validateData($(this).val(), /^1[34578]{1}\d{9}$/)) {
            case 0:
                mobileResult = false;
                tooltipWrong($('#requestMobile'), "手机号格式不对", 3);
                break;
            case -1:
                mobileResult = false;
                tooltipWrong($('#requestMobile'), "手机号不能为空", 3);
                break;
            case 1:
                mobileResult = true;
                break;
            default:
                tooltipWrong($(this), "数据验证出现问题", 3);
        }
    });
    $('#requestSubmit').on('click', function (e) {
        e.preventDefault();
        $('#requestMobile').blur();
        if (mobileResult) {
            var params = new Object();
            params.mobile = $('#requestMobile').val();
            ajaxRequest('/Home/Setting/updateNotice', params, 'post', successCallback, errorCallback);
        }
    });
});